#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/hash_policy.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ps putchar(' ')
#define pe putchar('\n')
#define int long long
#define eb emplace_back
#define pi pair<int, int>
#define mk make_pair
#define fi first
#define se second
#define Ad tr[p].ad
// #define Ad t[p].ad
#define ls p << 1
#define rs p << 1 | 1
// #define ls tr[p].son[0]
// #define rs tr[p].son[1]
// #define ls t[p].son[0]
// #define rs t[p].son[1]
#define len (r - l + 1)
#define mid ((l + r) >> 1)
using namespace std;
// using namespace __gnu_pbds;
inline int read()
{
    int f = 0, ans = 0;
    char c = getchar();
    while (!isdigit(c))
        f |= c == '-', c = getchar();
    while (isdigit(c))
        ans = (ans << 3) + (ans << 1) + c - 48, c = getchar();
    return f ? -ans : ans;
}
template <typename... args>
inline void read(args &...arg) { int arr[] = {(arg = read())...}; }
void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
const int N = 2e5 + 5, M = N << 2, inf = 1e18, mod = 998244353;
int n, a[N];
int mx, ans;
inline int get()
{
    int ans = 0;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; i - j + 1 >= 1 && i + j - 1 <= n; ++ans, ++j)
            if (a[i - j + 1] != a[i + j - 1])
                break;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; i - j + 1 >= 1 && i + j <= n; ++ans, ++j)
            if (a[i - j + 1] != a[i + j])
                break;
    return ans;
}
signed main()
{
    freopen("palindrome.in", "r", stdin);
    freopen("palindrome.out", "w", stdout);
    read(n);
    for (int i = 1; i <= n; ++i)
        read(a[i]);
    sort(a + 1, a + n + 1);
    do
    {
        int gt = get();
        if (gt > mx)
            mx = gt, ans = 1;
        else if (gt == mx)
            ++ans;
    } while (next_permutation(a + 1, a + n + 1));
    write(mx), ps, write(ans);
    return 0;
}
